package com.example.guava;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

/**
 * XXX
 *
 * @author : jamesfu
 * @date : 6/5/2019
 * @time : 10:25 AM
 */
@Slf4j
public class RateTask implements Callable<Integer> {

    private String taskId;

    public RateTask(String id){
        taskId = id;
    }

    /**
     * Computes a result, or throws an exception if unable to do so.
     *
     * @return computed result
     * @throws Exception if unable to compute a result
     */
    @Override
    public Integer call() throws Exception {

        log.info("Task #{} executing...", taskId);
        TimeUnit.SECONDS.sleep(2);

        return 10;
    }
}
